package com.ruoyi.web.controller.app.controller;

import com.ruoyi.framework.web.exception.base.XResult;
import com.ruoyi.web.controller.app.service.AppPersonalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

/**
 * @ClassName PersonalDataController
 * @Description TODO
 * @Author tyc@yanyu
 * @Date 2018/12/10 0010 09:37
 **/
@RestController
@RequestMapping("/app/personalData")
@Api(tags = "闺蜜圈个人资料")
public class AppPersonalController {
    @Autowired
    private AppPersonalService personalService;



    @RequestMapping(value = "addPerson",method = RequestMethod.POST)
    @ApiOperation(value = "新增个人资料",position = 1,notes = "新增个人资料")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "memberId", value = "用户ID号", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "nickName", value = "昵称", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sex", value = "性别", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "birthday", value = "出生日期", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "height", value = "身高", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "weight", value = "体重", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "declaration", value = "交友宣言", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "objective", value = "交友目的", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "occupation", value = "职业", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "hobby", value = "爱好", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "speciality", value = "特长", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "loveConcept", value = "恋爱观念", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "firstTimeHope", value = "首次见面希望做的事", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "likePlace", value = "喜欢相约的地点", required = false, dataType = "String", paramType = "query"),
           // @ApiImplicitParam(name = "recentOnLineTime", value = "最近上线时间", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "backgroundPicture", value = "背景图片", required = false, dataType = "String", paramType = "query")
    })
    public XResult addPerson(@RequestParam @ApiIgnore Map<String,String> map){

        return new XResult("操作成功",personalService.addPersonal(map));
    }

    @RequestMapping(value = "updatePersonal",method = RequestMethod.POST)
    @ApiOperation(value = "修改个人资料",position = 2,notes = "修改个人资料")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "memberId", value = "用户ID号", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "nickName", value = "昵称", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sex", value = "性别", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "birthday", value = "出生日期", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "height", value = "身高", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "weight", value = "体重", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "declaration", value = "交友宣言", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "objective", value = "交友目的", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "occupation", value = "职业", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "hobby", value = "爱好", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "speciality", value = "特长", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "loveConcept", value = "恋爱观念", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "firstTimeHope", value = "首次见面希望做的事", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "likePlace", value = "喜欢相约的地点", required = false, dataType = "String", paramType = "query"),
            //@ApiImplicitParam(name = "recentOnLineTime", value = "最近上线时间", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "backgroundPicture", value = "背景图片", required = false, dataType = "String", paramType = "query")
    })
    public XResult updatePersonal(@RequestParam @ApiIgnore Map<String,String> map){
        return new XResult("操作成功",personalService.updatePersonal(map));
    }

    /**
     * 闺蜜圈资料列表
     * @param memberId
     * @return
     */
    @RequestMapping(value = "getPersonalList",method = RequestMethod.POST)
    @ApiOperation(value = "闺蜜圈个人资料列表",position = 3,notes = "闺蜜圈个人资料列表")
    @ApiImplicitParam(name = "memberId", value = "用户ID号", required = true, dataType = "String", paramType = "query")
    public  XResult getPersonalList(String memberId){
        return new XResult("操作成功",personalService.getPersonalList(memberId));
    }

    /**
     * 登录后修改上线时间
     * @param memberId
     * @return
     */
    @RequestMapping(value = "updateOnLineTime",method = RequestMethod.POST)
    @ApiOperation(value = "修改上线时间",position = 4,notes = "修改上线时间")
    @ApiImplicitParam(name = "memberId", value = "用户ID号", required = true, dataType = "String", paramType = "query")
    public  XResult updateOnLineTime(String memberId){
        return new XResult("操作成功",personalService.updateOnLineTime(memberId));
    }
}
